﻿export default url => {
    const crud = window.$crud(url)
    
    // 回收站数据
    crud.getRecycles =(params)=> window.$axios({
        url: `${url}/recycle`,
        method: 'get',
        params
    })

    // 文件夹
    crud.addFolder =(data)=> window.$axios({
        url: `${url}/folder`,
        method: 'post',
        data
    })
    crud.reNameFolder =(id,name)=> window.$axios({
        url: `${url}/folder/rename/${id}/${name}`,
        method: 'put'
    })

    crud.moveFolder =(id,toid)=> window.$axios({
        url: `${url}/folder/move/${id}/${toid}`,
        method: 'put'
    })

    crud.deleteFolder =(id)=> window.$axios({
        url: `${url}/folder/${id}`,
        method: 'delete'
    })

    // 文件
    crud.renameFile =(fileId,name)=> window.$axios({
        url: `${url}/rename/${fileId}/${name}`,
        method: 'put',
    })
    
    crud.vdeleteFile =(id,level)=> window.$axios({
        url: `${url}/vdelete/${id}`,
        method: 'delete',
        data:{ids:level}
    })

    
    crud.deleteFile =(id)=> window.$axios({
        url: `${url}/${id}`,
        method: 'delete'
    })
    

    crud.moveFile =(id,toid)=> window.$axios({
        url: `${url}/move/${id}/${toid}`,
        method: 'put'
    })

    crud.restoreFile =(id)=> window.$axios({
        url: `${url}/restore/${id}`,
        method: 'put'
    })

    
    




    // 权限设置
    crud.addAuth =(data)=> window.$axios({
        url: `${url}/auth`,
        method: 'post',
        data
    })

    crud.updateAuth =(id,data)=> window.$axios({
        url: `${url}/auth/${id}`,
        method: 'put',
        data
    })

    crud.deleteAuth =(id)=> window.$axios({
        url: `${url}/auth/${id}`,
        method: 'delete'
    })

    crud.getAuthList =(id)=> window.$axios({
        url: `${url}/auth/${id}`,
        method: 'get'
    })

    crud.getRootAuth =()=> window.$axios({
        url: `${url}/rootAuth/`,
        method: 'get'
    })




    // 流程相关
    crud.getListByWF =(ids)=> window.$axios({
        url: `${url}/wfList`,
        method: 'post',
        data:{ids}
    })

    crud.getByWF =(id)=> window.$axios({
        url: `${url}/wf/${id}`,
        method: 'get'
    })


    return {
        ...crud
    }
}